|
|
|
|
|
|
|
The real advantage of using the QuickData property is that it can accept data from most spreadsheets through Windows cut and paste operations. By placing tab-delimited data on the Windows Clipboard, you can use that data as the input for the QuickData property. |
|
|
|
|
| |
|
|
|
|
Because you are working with data tables, you won't use the QuickData property to transfer datasets to the graph control. You can refer to the Visual Basic documentation for more information on using the Windows Clipboard and QuickData. |
|
|
|
|
|
|
|
|
|
|
One of the handier uses of the QuickData property is the ability to read a tab-delimited text file and produce a quick graph of the data. You can use Microsoft Notepad, WordPad, or any other text editor to put tab-delimited values into a disk file and then read that file from your Visual Basic program. You can even program Microsoft Word to read data from a Word table and produce a tabbed list of numbers for input into the graph control. |
|
|
|
|
|
|
|
|
To demonstrate this ability, add a new button to the form. Set its Name property to cmdLoadData and its Caption property to &Load Data. Now add the code from Listing 11.4 to the Click event of the cmdLoadData button. |
|
|
|
|
|
|
|
|
Listing 11.4. Reading a disk file and filling a graph. |
|
|
|
|
|
|
|
|
Private Sub cmdAutoSales_Click()
'
' add data using VB code
'
Dim intLoop As Integer
'
Graph1.DataReset = gphAllData ' clear out all properties
Graph1.GraphType = gphBar3D ' use 3d bar chart
'
Graph1.NumSets = 1 ' only one set of data
Graph1.NumPoints = 12 ' one for each month
'
' now add the data
'
Graph1.AutoInc = 1 ' turn on auto incrementing
For intLoop = 1 To 12
Graph1.GraphData = intLoop ' data to load
Next
'
Graph1.DrawMode = gphDraw ' show results
'
End Sub |
|
|
|
|
|